package org.hawk.gwtppc.webtest.tests.classsuite;

import java.lang.reflect.Modifier;

import org.hawk.gwtppc.webtest.common.Asserts;
import org.hawk.gwtppc.webtest.common.Test;
import org.hawk.gwtppc.webtest.tests.mock.AnnotationMock;
import org.hawk.gwtppc.webtest.tests.mock.ClassMock;
import org.hawk.gwtppc.webtest.tests.mock.EnumMock;
import org.hawk.gwtppc.webtest.tests.mock.InterfaceMock;
import org.hawk.gwtppc.webtest.tests.mock.SubClassMock1;
import org.hawk.gwtppc.webtest.tests.mock.SubClassMock2;
import org.hawk.gwtppc.webtest.tests.mock.SubClassMock3;

public class GetDeclaredConstructorTest implements Test {

	public void run() throws Throwable {
		try {
			AnnotationMock.class.getDeclaredConstructor();
			Asserts.fail("Annotation has no constructors");
		} catch (NoSuchMethodException ex) {
		}
		try {
			InterfaceMock.class.getDeclaredConstructor();
			Asserts.fail("Interface has no constructors");
		} catch (NoSuchMethodException ex) {
		}
		Asserts.assertEquals(EnumMock.class.getDeclaredConstructor(String.class,int.class).toString(), "private org.hawk.gwtppc.webtest.tests.mock.EnumMock(java.lang.String,int)");
		Asserts.assertEquals(ClassMock.class.getDeclaredConstructor().toString(), "public org.hawk.gwtppc.webtest.tests.mock.ClassMock()");
		Asserts.assertEquals(ClassMock.class.getDeclaredConstructor().getModifiers(), Modifier.PUBLIC);
		Asserts.assertEquals(SubClassMock1.class.getDeclaredConstructor().toString(), "public org.hawk.gwtppc.webtest.tests.mock.SubClassMock1()");
		Asserts.assertEquals(SubClassMock1.class.getDeclaredConstructor().getModifiers(), Modifier.PUBLIC);
		Asserts.assertEquals(SubClassMock2.class.getDeclaredConstructor(String.class).toString(), "public org.hawk.gwtppc.webtest.tests.mock.SubClassMock2(java.lang.String)");
		Asserts.assertEquals(SubClassMock2.class.getDeclaredConstructor(String.class).getModifiers(), Modifier.PUBLIC);
		Asserts.assertEquals(SubClassMock2.class.getDeclaredConstructor(int.class).toString(), "public org.hawk.gwtppc.webtest.tests.mock.SubClassMock2(int)");
		Asserts.assertEquals(SubClassMock2.class.getDeclaredConstructor(int.class).getModifiers(), Modifier.PUBLIC);
		Asserts.assertEquals(SubClassMock2.class.getDeclaredConstructor(boolean.class).toString(), "protected org.hawk.gwtppc.webtest.tests.mock.SubClassMock2(boolean)");
		Asserts.assertEquals(SubClassMock2.class.getDeclaredConstructor(boolean.class).getModifiers(), Modifier.PROTECTED);
		Asserts.assertEquals(SubClassMock2.class.getDeclaredConstructor(ClassMock.class, boolean.class).toString(), "private org.hawk.gwtppc.webtest.tests.mock.SubClassMock2(org.hawk.gwtppc.webtest.tests.mock.ClassMock,boolean)");
		Asserts.assertEquals(SubClassMock2.class.getDeclaredConstructor(ClassMock.class, boolean.class).getModifiers(), Modifier.PRIVATE);
		Asserts.assertEquals(SubClassMock3.class.getDeclaredConstructor().toString(), "protected org.hawk.gwtppc.webtest.tests.mock.SubClassMock3()");
		Asserts.assertEquals(SubClassMock3.class.getDeclaredConstructor().getModifiers(), Modifier.PROTECTED);
	}

	public String getName() {
		return "getDeclaredConstructor(Class)";
	}

}
